<?php include 'headers.php' ?>

<?php
if(isset($_COOKIE['login']) and !isset($_SESSION['login']))
{
 $_SESSION['login'] = $_COOKIE['login'];
}


        echo'<form action="books.php" method="post">
           <input type="submit" name ="dalej" value="dalej" />
        </form>';
    if(isset($_POST['pass']))
    {
    $_SESSION['login']=$_POST["fname"];
    }
    if(isset($_SESSION['login']))
         {
          echo 'Witaj'.$_SESSION['login'].'!';
          setcookie('login', $_SESSION['login'], time()+3600);
          echo'<form action="index.php" method="post">          
                <input type="submit" name="logout" value="Wyloguj"/>
                </form>';   
          
          
         }
?>


